import type { userType } from '@/types/user'
import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useUserStore = defineStore('cp-user', () => {
    // 用户信息
    const user = ref<userType>()
    // 设置用户 登录后使用
    const setUser = (u: userType) => {
        user.value = u
    }
    // 删除用户
    const delUser = () => {
        user.value = undefined
    }
    return{
        user,
        setUser,
        delUser
    }
    },
    // 存储到本地
    {
    persist: true
})
